package com.example.nocodesqlapi.repository;

import com.example.nocodesqlapi.model.SqlExecuteLog;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface SqlExecuteLogRepository extends JpaRepository<SqlExecuteLog, Long> {
    
    // 根据SQL配置ID查询日志
    List<SqlExecuteLog> findBySqlConfigIdOrderByCreateTimeDesc(Long sqlConfigId);
    
    // 查询最近的N条日志
    List<SqlExecuteLog> findTop100ByOrderByCreateTimeDesc();
}
